package com.flashflexpro.flexdirector.adapter.codec {
import com.flashflexpro.flexdirector.adapter.descriptor.DescPropertyAuto;

import com.flashflexpro.flexdirector.model.CodeStringValue;

import mx.automation.IAutomationObject;

public class CodecListData extends CodecDefault{


    override public function encode(obj:Object, descProperty:DescPropertyAuto, relativeParent:IAutomationObject ):CodeStringValue{
        var val:Object = getMemberFromObject( obj, descProperty);
		if (val != null){
		    val = relativeParent.automationTabularData.getAutomationValueForData(val).join(" | ");
		}
        var rt:CodeStringValue = new CodeStringValue();
        rt.desc = descProperty.getDto();
        rt.code = "\"" + val + "\"";
        rt.value = rt.string = val as String;
        return rt;
    }

    override public function decode(obj:Object, value:Object, descProperty:DescPropertyAuto, relativeParent:IAutomationObject, inString:Boolean = false):void {
        throw new Error( "Here should never be called!" );
    }
}
}